/**
 *  \file I3TimerEvent.h
 *  \brief Similar to TimerEvent.  Except that we can have functors which
 *  have i3 specific arguments.
 */

#ifndef I3_TIMER_EVENT_H
#define I3_TIMER_EVENT_H 1

#ifndef _WIN32
	#include <sys/time.h>
#endif

#include "OCD_include.h"
#include "I3Functor.h"

/**
  * This class extends TimerEvent to include callbacks on i3 specific functors.
  * The reason for a different class is to separate out i3 specific features from the
  * generic classes, to the largest extent possible.
  */
class I3TimerEvent:public TimerEvent {
    /**
      * Creates a new I3 timer event.
      * @param cbk The functor to be invoked when event fires.
      */
    I3TimerEvent(time_t seconds, suseconds_t microSeconds, I3Functor* cbk, bool cbkFreeFlag) ;
    I3TimerEvent(time_t seconds, suseconds_t microSeconds, I3Functor* cbk, bool cbkFreeFlag, char *desc) ;
    ~I3TimerEvent();


public:
    
    static I3TimerEvent* create(time_t seconds, suseconds_t microSeconds, I3Functor* cbk, bool cbkFreeFlag = false) ;
    static I3TimerEvent* create(time_t seconds, suseconds_t microSeconds, I3Functor* cbk, char *desc, bool cbkFlag = false) ;
    static void destroy (I3TimerEvent *);
    
    void execute();
};

#endif
